package com.tbit.uqbike.webmanager.dao.stat;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.tbit.config.datasource.DataSource;
import com.tbit.uqbike.object.pojo.MoneyData;
import com.tbit.uqbike.object.pojo.NameCount;
import com.tbit.uqbike.object.pojo.StatPark;
import com.tbit.uqbike.object.pojo.statistics.RideOrderDaySta;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

@DS(DataSource.STAT)
public interface RideOrderDayStaDao {
    int insert(RideOrderDaySta record);

    int insertSelective(RideOrderDaySta record);

    int insertBatch(@Param("entities") List<Map<String, Object>> list);

    int insertBatchByRegionId(@Param("entities") List<Map<String, Object>> list);

    int insertByMap(Map<String, Object> params);

    int insertByRegionId(Map<String, Object> params);

    int insertByMapAndRegionId(Map<String, Object> params);

    List<RideOrderDaySta> queryByMap(Map<String, Object> params);


    List<RideOrderDaySta> queryByMapByRegion(Map<String, Object> params);

    List<RideOrderDaySta> queryByMapAndRegionId(Map<String, Object> params);

    List<RideOrderDaySta> queryByRegionId(Map<String, Object> params);

    List<MoneyData> groupByAccountId(Map<String, Object> map1);

    List<StatPark> statByType(Map<String, Object> params);

    List<StatPark> statRegion(Map<String, Object> params);


    void update(RideOrderDaySta record);


    NameCount getRideOrder(Map<String, Object> map);

    /**
     * 获取每天的车辆数
     */
    StatPark getMachineNumByDay(Map<String, Object> map);

    /**
     * 获取区域内订单记录最早一天的数据量
     */
    Date getEarliestData(Integer accountId);

    /**
     * 查询分区的每天车辆数
     *
     * @param regionIds
     * @param names
     * @return
     */
    @MapKey("k")
    Map<String, Map> getMachineNumRegionByDay(@Param("regionIds") List<Integer> regionIds, @Param("names") List<String> names);


    /**
     * 批量删除骑行订单预统计
     * @param accountIdList 区域id
     * @param st 开始时间
     * @param et 结束时间
     */
    void deleteById(@Param("List") List<Integer> accountIdList, @Param("st") String st, @Param("et") String et);
}